home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-17 | 3.2 KB | 125 lines | [TEXT/MPS ] |
- {
- File: ColorPicker.p
-
- Copyright: © 1984-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Version: Universal Interfaces 2.0a1. ETO #15, MPW prerelease. Sunday, July 17, 1994.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT ColorPicker;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __COLORPICKER__}
- {$SETC __COLORPICKER__ := 1}
-
- {$I+}
- {$SETC ColorPickerIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
-
- {$IFC UNDEFINED __QUICKDRAW__}
- {$I Quickdraw.p}
- {$ENDC}
- { Types.p }
- { ConditionalMacros.p }
- { MixedMode.p }
- { QuickdrawText.p }
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- CONST
- {Maximum small fract value, as long}
- MaxSmallFract = $0000FFFF;
-
- { A SmallFract value is just the fractional part of a Fixed number,
- which is the low order word. SmallFracts are used to save room,
- and to be compatible with Quickdraw's RGBColor. They can be
- assigned directly to and from INTEGERs. }
- { Unsigned fraction between 0 and 1 }
-
- TYPE
- SmallFract = INTEGER;
-
- { For developmental simplicity in switching between the HLS and HSV
- models, HLS is reordered into HSL. Thus both models start with
- hue and saturation values; value/lightness/brightness is last. }
- HSVColor = RECORD
- hue: SmallFract; {Fraction of circle, red at 0}
- saturation: SmallFract; {0-1, 0 for gray, 1 for pure color}
- value: SmallFract; {0-1, 0 for black, 1 for max intensity}
- END;
- HSLColor = RECORD
- hue: SmallFract; {Fraction of circle, red at 0}
- saturation: SmallFract; {0-1, 0 for gray, 1 for pure color}
- lightness: SmallFract; {0-1, 0 for black, 1 for white}
- END;
- CMYColor = RECORD
- cyan: SmallFract;
- magenta: SmallFract;
- yellow: SmallFract;
- END;
-
- FUNCTION Fix2SmallFract(f: Fixed): SmallFract;
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0001, $A82E;
- {$ENDC}
- FUNCTION SmallFract2Fix(s: SmallFract): Fixed;
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0002, $A82E;
- {$ENDC}
- PROCEDURE CMY2RGB(cColor: CMYColor; VAR rColor: RGBColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0003, $A82E;
- {$ENDC}
- PROCEDURE RGB2CMY(rColor: RGBColor; VAR cColor: CMYColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0004, $A82E;
- {$ENDC}
- PROCEDURE HSL2RGB(hColor: HSLColor; VAR rColor: RGBColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0005, $A82E;
- {$ENDC}
- PROCEDURE RGB2HSL(rColor: RGBColor; VAR hColor: HSLColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0006, $A82E;
- {$ENDC}
- PROCEDURE HSV2RGB(hColor: HSVColor; VAR rColor: RGBColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0007, $A82E;
- {$ENDC}
- PROCEDURE RGB2HSV(rColor: RGBColor; VAR hColor: HSVColor);
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0008, $A82E;
- {$ENDC}
- FUNCTION GetColor(where: Point; prompt: ConstStr255Param; inColor: RGBColor; VAR outColor: RGBColor): BOOLEAN;
- {$IFC NOT GENERATINGCFM}
- INLINE $3F3C, $0009, $A82E;
- {$ENDC}
-
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := ColorPickerIncludes}
-
- {$ENDC} {__COLORPICKER__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-